#ifndef _USER_MAX98357A_H
#define _USER_MAX98357A_H

#include "stdbool.h"
#include "stdint.h"

#define I2S_CHANNEL             (1)
#define I2S_REC_BIT             (16)
#define I2S_REC_SAMPLE_RATE     (44100)
#define I2S_SAMPLE_SIZE         (I2S_REC_BIT * 1024)
#define I2S_BYTE_RATE           (I2S_REC_SAMPLE_RATE * (I2S_REC_BIT / 8)) * I2S_CHANNEL
#define I2S_NUM                 0
#define I2S_PIN_BCK_GPIO        13
#define I2S_PIN_WS_GPIO         15
#define I2S_PIN_DATA_PLAYBACK   14

#define WAV_LIST_MAX 20

struct wavinfo
{
    char *name;       // wav file path
    bool status;      // playing is 1, stop is 0
    int current_time;    // last stop time

    int bit;          // bit
    int channel;        
    int sample_rate;
    int while_time;   // sample num
    int format;
    struct wavinfo * next;
};


extern int current_list_num;
extern uint8_t play_index;
extern struct wavinfo list[WAV_LIST_MAX];

void init_i2s(void);
void playback_wav(char *wav_name);
void generate_wav_header(char* wav_header, uint32_t wav_size, uint32_t sample_rate);
void user_max98357a_task(void *args);


#endif
